<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js"></script>
</head>
<body>
<button onclick="test()">点击</button>
</body>
</html>
<script>
    const lists = [
        {id: 1},
        {id: 2},
        {id: 3},
        {id: 4},
        {id: 5},
        {id: 6},
        {id: 7},
        {id: 8},
        {id: 9},
        {id: 10},
        {id: 11},
        {id: 12},
        {id: 13},
        {id: 14},
        {id: 15},
        {id: 16},
        {id: 17},
        {id: 18},
        {id: 19},
        {id: 20},

    ]

    function test () {
        let data = lists;
        const arr =_.chunk(data, 2)

        const timer = setInterval(()=> {
            if (arr.length === 0) {
                clearInterval(timer)
                return
            }
            const list = arr.pop()
            list.forEach(item => {
                getInstruments(item.id)
            })
        },2000)
    }

    function getInstruments(id) {
        console.log(id)
    }

</script>